<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改项目立项')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
    	<!-- 打印网页时通过hidden-print隐藏元素 -->
	    <div class="text-right hidden-print">
	        <input th:value="${gcProject.id}" type="hidden" id="id" name="id" />
            <button id="button-yes" type="button" class="btn btn-sm btn-primary" ><i class="fa fa-check"></i>审核通过</button>&nbsp;
            <button id="button-no" type="button" class="btn btn-sm btn-danger" ><i class="fa fa-remove"></i>审核拒绝</button>&nbsp;
            <button type="button" class="btn btn-sm btn-danger" onclick="closeItem()"><i class="fa fa-reply-all"></i>关 闭 </button>
	    </div>
        <form class="form-horizontal m" id="form-project-edit" th:object="${gcProject}">
        	<h4 class="form-header h4">项目详情</h4>
            <div class="form-group">    
                <label class="col-sm-2 control-label">项目编号：</label>
                <div class="col-sm-4" style="top: 8px">
                    <span th:text="*{orderNo}" >
                </div>
                <label class="col-sm-2 control-label ">单位名称：</label>
                <div class="col-sm-4" style="top: 8px">
                	<span th:text="*{customerName}" >
                </div>
                
<!--                 <label class="col-sm-1 control-label ">项目地址：</label> -->
<!--                 <div class="col-sm-2" style="top: 8px"> -->
<!--                     <span th:text="${xmxq.xmdz}" > -->
<!--                 </div> -->
            </div>
            <div class="form-group"> 
            	<label class="col-sm-2 control-label ">项目名称：</label>
                <div class="col-sm-4" style="top: 8px">
                    <span th:text="*{name}" >
                </div> 
            	<label class="col-sm-2 control-label ">合同总金额：</label>
            	<div class="col-sm-4" style="top: 8px">
                    <span th:text="*{zongje}" >
                </div>
<!--                 <label class="col-sm-1 control-label ">支付方式：</label> -->
<!--                 <div class="col-sm-5" style="top: 8px"> -->
<!--                     <span th:text="${xmxq.fkfs}" > -->
<!--                 </div> -->
<!--                 <label class="col-sm-1 control-label ">开票税率：</label> -->
<!--                 <div class="col-sm-2" style="top: 8px"> -->
<!--                     <span th:text="${xmxq.kpsl}" />% -->
<!--                 </div> -->
            </div>
            <div class="form-group">
                <input type="hidden" id="xmxqzilwj" name="xmxqzilwj" th:value="${xmxq.zilwj}" />
                <label class="col-sm-2 control-label">评审合同文件：</label>
                <div class="col-sm-10" style="margin-top: 8px;" id="xmxqzilwjlink">
                </div>
            </div>
            <div class="form-group">
                <input type="hidden" id="xmxqzhengsht" name="xmxqzhengsht" th:value="${xmxq.zhengsht}" />
                <label class="col-sm-2 control-label">正式合同文件：</label>
                <div class="col-sm-10" style="margin-top: 8px;" id="xmxqzhengshtlink">
                </div>
            </div>
            <h4 class="form-header h4" style="margin-top: 25px;">成本预估</h4>
<!--             <div class="form-group">     -->
<!--                 <label class="col-sm-1 control-label ">负责人：</label> -->
<!--                 <div class="col-sm-2" style="top: 8px"> -->
<!--                     <span th:text="${cbpjObj.xmfzr}" /> -->
<!--                 </div> -->
<!--                 <label class="col-sm-1 control-label ">评估时间：</label> -->
<!--                 <div class="col-sm-2" style="top: 8px"> -->
<!--                     <span th:text="${#dates.format(cbpjObj.pgsj, 'yyyy-MM-dd')}" /> -->
<!--                 </div> -->
<!--                 <label class="col-sm-1 control-label">成本合计：</label> -->
<!--                 <div class="col-sm-2" style="top: 8px"> -->
<!--                     <span th:text="${cbpjObj.cbhj}" /> -->
<!--                 </div> -->
<!--                 <label class="col-sm-1 control-label">利润预估：</label> -->
<!--                 <div class="col-sm-2" style="top: 8px"> -->
<!--                     <span th:text="${cbpjObj.lryg}" /> -->
<!--                 </div> -->
<!--             </div> -->
            <div class="form-group">
                <label class="col-sm-2 control-label">成本预估文件：</label>
                <input type="hidden" id="cbpjwjlis" name="cbpjwjlis" th:value="${cbpjwjlis}" />
                <div class="col-sm-10" style="margin-top: 8px;" id="cbpjwjlink">
                </div>
            </div>
<!--             <div class="form-group"> -->
<!-- 		        <div class="col-sm-12 "> -->
<!-- 				    <table id="bootstrap-table"></table> -->
<!-- 				</div> -->
<!-- 			</div> -->
            <h4 class="form-header h4" style="margin-top: 25px;">设计图纸</h4>
            <div class="form-group">
            	<input type="hidden" id="sjtzzlwj" name="sjtzzlwj" th:value="${sjtzlis}" />
                <label class="col-sm-2 control-label">设计图纸文件：</label>
                <div class="col-sm-10" style="margin-top: 8px;" id="sjtzzlwjlink"></div>
            </div>
            <h4 class="form-header h4" style="margin-top: 25px;">造价报价</h4>
            <div class="form-group">
            	<input type="hidden" id="zjbjzlwj" name="zjbjzlwj" th:value="${zjbjlis}" />
                <label class="col-sm-2 control-label">造价报价文件：</label>
                <div class="col-sm-10" style="margin-top: 8px;" id="zjbjzlwjlink"></div>
            </div>
            <h4 class="form-header h4" style="margin-top: 25px;">其他文件</h4>
            <div class="form-group">
            	<input type="hidden" id="qtwjzlwj" name="qtwjzlwj" th:value="${qtwjlis}" />
                <label class="col-sm-2 control-label">其他文件：</label>
                <div class="col-sm-10" style="margin-top: 8px;" id="qtwjzlwjlink"></div>
            </div>
<!--             <h4 class="form-header h4" style="margin-top: 25px;">招投标服务费</h4> -->
<!--             <div class="form-group">     -->
<!--                 <label class="col-sm-2 control-label ">项目名称：</label> -->
<!--                 <div class="col-sm-2" style="top: 8px"> -->
<!--                     <span th:text="${qtfylis.name}" /> -->
<!--                 </div> -->
<!--                 <label class="col-sm-2 control-label ">总金额：</label> -->
<!--                 <div class="col-sm-2" style="top: 8px"> -->
<!--                     <span th:text="${qtfylis.zongje}" /> -->
<!--                 </div> -->
<!--             </div> -->
<!--             <div class="form-group"> -->
<!--                 <label class="col-sm-2 control-label">资料文件：</label> -->
<!--                 <input type="hidden" id="qtfyzlwj" name="qtfyzlwj" th:value="${qtfylis.zlwj}" /> -->
<!--                 <div class="col-sm-10" style="margin-top: 8px;" id="qtfyzlwjlink"></div> -->
<!--             </div> -->
            
            <h4 class="form-header h4" style="margin-top: 25px;">审批意见</h4>
            <div class="form-group">
                <label class="col-sm-1 control-label">审批意见：</label>
                <div class="col-sm-11">
                	<textarea id="spyj" class="form-control"></textarea>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script th:src="@{/js/jquery.tmpl.js}"></script>
    <th:block th:include="include :: datetimepicker-js" />
    <script th:src="@{/ruoyi/base64.min.js?v=20231208}"></script>
    
    <script th:inline="javascript">
        var prefix = ctx + "gcgl/cbpj";
        
        $("input[name='pgsj']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });
        
        $(function() {
	    	// 初始化数据, 可以由后台传过来
	    	var data = [[${cbpjObj.item}]];
	    	
		    var options = {
		    	data: data,
                pagination: false,
		        showSearch: false,
                showRefresh: false,
                showToggle: false,
                showColumns: false,
                sidePagination: "client",
		        columns: [
		        {
		        	field: 'index',
		        	align: 'center',
		        	title: "序号",
                    formatter: function (value, row, index) {
                    	var columnIndex = $.common.sprintf("<input type='hidden' name='index' value='%s'>", $.table.serialNumber(index));
                    	var columnId = $.common.sprintf("<input type='hidden' name='item[%s].xuh' value='%s'>", index, row.id);
                    	return columnIndex + $.table.serialNumber(index) + columnId;
                    }
                },
                {
		            field: 'type',
		            align: 'center',
		            title: '成本类型',
		            width:140,
	                formatter: function(value, row, index) {
		            	var html = $.common.sprintf("<input class='form-control itemtype' type='hidden' name='item[%s].type' value='%s'>", index, value);
		        		return html + '<span>' + value + '</span>';
	                }
		        },
		        {
		            field: 'name',
		            align: 'center',
		            title: '名称及类型',
		            formatter: function(value, row, index) {
		            	var html = $.common.sprintf("<input class='form-control itemname' type='hidden' name='item[%s].name' value='%s'>", index, value);
		        		return html + '<span>' + value + '</span>';
                    }
		        },
		        {
		            field: 'xinghao',
		            align: 'center',
		            title: '型号',
		            formatter: function(value, row, index) {
		            	var html = $.common.sprintf("<input class='form-control itemxinghao' type='hidden' name='item[%s].xinghao' value='%s'>", index, value);
		        		return html + '<span>' + value + '</span>';
                    }
		        },
		        {
		            field: 'count',
		            align: 'center',
		            title: '数量',
		            formatter: function(value, row, index) {
		            	var html = $.common.sprintf("<input class='form-control itemcount' type='hidden' name='item[%s].count' value='%s'>", index, value);
		        		return html + '<span>' + value + '</span>';
                    }
		        },
		        {
		            field: 'suilv',
		            align: 'center',
		            title: '税率',
		            width:80,
			        formatter: function(value, row, index) {
		            	var html = $.common.sprintf("<input class='form-control itemtype' type='hidden' name='item[%s].suilv' value='%s'>", index, value);
		        		return html + '<span>' + value + '%</span>';
	                }
		        },
		        {
		            field: 'cbdj',
		            align: 'center',
		            title: '成本单价',
		            formatter: function(value, row, index) {
		            	var html = $.common.sprintf("<input class='form-control itemcbdj' type='hidden' name='item[%s].cbdj' value='%s'>", index, value);
		        		return html + '<span>' + value + '</span>';
                    }
		        },
		        {
		            field: 'xjjg',
		            align: 'center',
		            title: '小计价格',
		            formatter: function(value, row, index) {
		            	var html = $.common.sprintf("<input class='itemxjjg' type='hidden' name='item[%s].xjjg' value='%s'>", index, value);
		            	return html + '<span class="js-total-price">' + value + '</span>';
                    }
		        },
		        {
		            field: 'jxsj',
		            align: 'center',
		            title: '进项税金',
		            formatter: function(value, row, index) {
		            	var html = $.common.sprintf("<input class='itemjxsj' type='hidden' name='item[%s].jxsj' value='%s'>", index, value);
		            	return html + '<span class="js-total-jxsjprice">' + value + '</span>';
                    }
		        },
		        {
		            field: 'memo',
		            align: 'center',
		            title: '备注',
		            formatter: function(value, row, index) {
		            	var html = $.common.sprintf("<input class='form-control' type='hidden' name='item[%s].memo' value='%s'>", index, value);
		        		return html + '<span>' + value + '</span>';
                    }
		        }]
		    };
		    $.table.init(options);
		    
		  //设计图纸
			var sjtzzlwj = $("#sjtzzlwj").val();
        	var n=sjtzzlwj.split(",");
        	for(var i=0;i<n.length;i++){
        		if(n[i]!=""){
//         			var url = "http://lkgnews.cn:8012/onlinePreview?url="+encodeURIComponent(Base64.encode(n[i]));
        			var url = n[i];
	        		$("#sjtzzlwjlink").append("<a href='"+url+"' target='_blank' >"+n[i]+"</a>&nbsp;&nbsp;&nbsp;&nbsp;");
            		$("#sjtzzlwjlink").append("<a href='"+n[i]+"' target='_blank' >下载</a><br>");
        		}
        	}
        	
        	//项目合同附件
			var xmxqzilwj = $("#xmxqzilwj").val();
        	var n=xmxqzilwj.split(",");
        	for(var i=0;i<n.length;i++){
        		if(n[i]!=""){
// 	        		var url = "http://lkgnews.cn:8012/onlinePreview?url="+encodeURIComponent(Base64.encode(n[i]));
	        		var url = n[i];
	        		$("#xmxqzilwjlink").append("<a href='"+url+"' target='_blank' >"+n[i]+"</a>&nbsp;&nbsp;&nbsp;&nbsp;");
	        		$("#xmxqzilwjlink").append("<a href='"+n[i]+"' target='_blank' >下载</a><br>");
        		}
        	}
        	
        	//造价报价
			var zjbjzlwj = $("#zjbjzlwj").val();
        	var n=zjbjzlwj.split(",");
        	for(var i=0;i<n.length;i++){
        		if(n[i]!=""){
// 	        		var url = "http://lkgnews.cn:8012/onlinePreview?url="+encodeURIComponent(Base64.encode(n[i]));
	        		var url = n[i];
	        		$("#zjbjzlwjlink").append("<a href='"+url+"' target='_blank' >"+n[i]+"</a>&nbsp;&nbsp;&nbsp;&nbsp;");
	        		$("#zjbjzlwjlink").append("<a href='"+n[i]+"' target='_blank' >下载</a><br>");
        		}
        	}
        	
        	//其它资料文件
			var qtwjzlwj = $("#qtwjzlwj").val();
        	var n=qtwjzlwj.split(",");
        	for(var i=0;i<n.length;i++){
        		if(n[i]!=""){
//         			var url = "http://lkgnews.cn:8012/onlinePreview?url="+encodeURIComponent(Base64.encode(n[i]));
        			var url = n[i];
	        		$("#qtwjzlwjlink").append("<a href='"+url+"' target='_blank' >"+n[i]+"</a>&nbsp;&nbsp;&nbsp;&nbsp;");
	        		$("#qtwjzlwjlink").append("<a href='"+n[i]+"' target='_blank' >下载</a><br>");
        		}
        	}
        	
        	//其它费用
// 			var qtfyzlwj = $("#qtfyzlwj").val();
//         	var n=qtfyzlwj.split(",");
//         	for(var i=0;i<n.length;i++){
//         		if(n[i]!=""){
// // 	        		var url = "http://lkgnews.cn:8012/onlinePreview?url="+encodeURIComponent(Base64.encode(n[i]));
// 	        		var url = n[i];
// 	        		$("#qtfyzlwjlink").append("<a href='"+url+"' target='_blank' >"+n[i]+"</a>&nbsp;&nbsp;&nbsp;&nbsp;");
// 	        		$("#qtfyzlwjlink").append("<a href='"+n[i]+"' target='_blank' >下载</a><br>");
//         		}
//         	}
        	
        	//其它资料文件
			var cbpjwj = $("#cbpjwjlis").val();
        	var n=cbpjwj.split(",");
        	for(var i=0;i<n.length;i++){
        		if(n[i]!=""){
//         			var url = "http://lkgnews.cn:8012/onlinePreview?url="+encodeURIComponent(Base64.encode(n[i]));
        			var url = n[i];
	        		$("#cbpjwjlink").append("<a href='"+url+"' target='_blank' >"+n[i]+"</a>&nbsp;&nbsp;&nbsp;&nbsp;");
	        		$("#cbpjwjlink").append("<a href='"+n[i]+"' target='_blank' >下载</a><br>");
        		}
        	}
    	});
        
        $("#button-yes").click(function(){
	    	$.modal.confirm("确认要审核通过吗?", function() {
	    		$.ajax({
    				url: "/gcgl/project/zjlyes",
    				type: "post",
    				data: { "ids": $("#id").val(),"spyj": $("#spyj").val() },
    				dataType: 'json',
    				success: function(data) {
    					$.operate.saveReload(data);
    				},
    				error: function(xhr, type, errorThrown) {
    					//异常处理；
    					$.modal.alert("请稍后再试！");
    					$.operate.saveReload(data);
    				}
    			});
	    	});
	    })
	    
	    $("#button-no").click(function(){
	    	$.modal.confirm("确认要审核拒绝吗?", function() {
	    		$.ajax({
    				url: "/gcgl/project/zjlno",
    				type: "post",
    				data: { "ids": $("#id").val(),"spyj": $("#spyj").val() },
    				dataType: 'json',
    				success: function(data) {
    					$.operate.saveReload(data);
    				},
    				error: function(xhr, type, errorThrown) {
    					//异常处理；
    					$.modal.alert("请稍后再试！");
    					$.operate.saveReload(data);
    				}
    			});
	    	});
	    })
    </script>
</body>
</html>